package com.example.domain.entity;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

@TableName("meeting_room_orders")
@Data
public class Orders {
    public static final String ORDER_ID = "order_id";
    public static final String CREATE_TIME = "create_time";
    public static final String USER_ID = "user_id";
    public static final String ROOM_ID = "room_id";
    public static final String TOTAL_PRICE = "total_price";
    public static final String PAYMENT_DEADLINE = "payment_deadline";
    public static final String ACTUAL_PAYMENT_TIME = "actual_payment_time";
    public static final String STATUS = "status";
    public static final String START_TIME = "startTime";
    public static final String END_TIME = "endTime";

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId(value = ORDER_ID, type = IdType.ASSIGN_ID)
    private Long orderId;

    @TableField(CREATE_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime createTime;

    @TableField(value = USER_ID,updateStrategy = FieldStrategy.DEFAULT)
    private Integer userId;

    @TableField(value = ROOM_ID,updateStrategy = FieldStrategy.DEFAULT)
    private Integer roomId;

    @TableField(TOTAL_PRICE)
    private Double totalPrice;

    @TableField(PAYMENT_DEADLINE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime paymentDeadline;

    @TableField(ACTUAL_PAYMENT_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime actualPaymentTime;

    @TableField(STATUS)
    private Integer status;

    @TableField(exist = false)
    private String reserveTime;

    @TableField(exist = false)
    private String duration;

    @TableField(START_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime startTime;

    @TableField(END_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime endTime;
}